Stored Procedures [dbo].[asi_GetHandlingPrice]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@valuedecimal(18,4)9
@priceCodeint4
SQL Script
CREATE  PROCEDURE [dbo].[asi_GetHandlingPrice]

@value decimal(18,4),
@priceCode int

AS

--Attempt to retrieve an appropriate handling charge
SELECT COALESCE(
            (SELECT
                TOP 1 hp.Price
            FROM
                HandlingPrice hp
            WHERE
                hp.MinAmount <= @value
                AND hp.HandlingPriceCode = @priceCode
            ORDER BY hp.MinAmount DESC),
            -1)

GO
Uses